package com.niuke;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

/**
 * 27. 荒岛逃生游戏
 * https://www.bilibili.com/read/cv25360595 (荒岛求生)
 */
public class NiukeMoni27 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String[] input = scanner.nextLine().split(" ");

        List<Integer> zheng = new ArrayList<>();
        List<Integer> fu = new ArrayList<>();
        int zhengSum = 0;
        int fuSum = 0;
        for (int i = 0; i < input.length; i++) {
            Integer p = Integer.parseInt(input[i]);
            if (p > 0) {
                zheng.add(p);
                zhengSum += p;
            }
            if (p < 0) {
                fu.add(-p);
                fuSum += -p;
            }
        }

        if (zhengSum == fuSum) {
            System.out.println("0");
        } else {

            // 正数 和 负数，和的绝对值小的一方始终不会有人能逃生，因为会不断消耗至体力为0
            // 算出最终能剩下的体力，然后从小到大相加，小于剩余体力就能逃生，超过之后就不再能逃生
            zheng.sort(new Comparator<Integer>() {
                @Override
                public int compare(Integer integer, Integer t1) {
                    return integer - t1;
                }
            });
            fu.sort(new Comparator<Integer>() {
                @Override
                public int compare(Integer integer, Integer t1) {
                    return integer - t1;
                }
            });

            int res = 0;
            int temp = 0;
            int cha = Math.abs(zhengSum - fuSum);
            if (zhengSum > fuSum) {
                for (int i = 0; i < zheng.size(); i++) {
                    temp += zheng.get(i);
                    res++;
                    if (temp >= cha) {
                        break;
                    }
                }
            } else {
                for (int i = 0; i < fu.size(); i++) {
                    temp += fu.get(i);
                    res++;
                    if (temp >= cha) {
                        break;
                    }
                }
            }

            System.out.println(res);
        }

    }

}
